﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using BUS;

namespace ProjectM2Work.Pages
{
    public partial class PageGopY : PhoneApplicationPage
    {
        public PageGopY()
        {
            InitializeComponent();
            
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            txtIDTu.Text = NavigationContext.QueryString["ID"];
            txtTuNgu.Text = NavigationContext.QueryString["TuNgu"];
        }

        private void imgThongTin_MouseLeave(object sender, MouseEventArgs e)
        {
            App.ZoomInImage(sender);
        }

        private void imgThongTin_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            App.ZoomOutImage(sender);
        }

        private void imgThongTin_MouseMove(object sender, MouseEventArgs e)
        {
            App.ZoomOutImage(sender);
        }

        private void imgThongTin_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Pages/PageThongTin.xaml", UriKind.Relative));
        }

        private void imgHuy_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (NavigationService.CanGoBack)
            {
                NavigationService.GoBack();
            }
        }

        private void imgTaiLen_ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {

        }

        private void imgHuy_ImageFailed(object sender, ExceptionRoutedEventArgs e)
        {

        }

        private void imgTaiLen_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (txtBietDanh.Text != "" && txtEmail.Text != "" && txtNhanXet.Text != "")
            {
                Service_m2work._clientFeedBackDTO.Hoten = txtBietDanh.Text;
                Service_m2work._clientFeedBackDTO.Email = txtEmail.Text;
                Service_m2work._clientFeedBackDTO.Mota = txtNhanXet.Text;
                Service_m2work._clientFeedBackDTO.Iddtu = Int32.Parse(txtIDTu.Text);
                Service_m2work._clientFeedBackDTO.Tu = txtTuNgu.Text;

                Service_m2work.AddRecordFeedBack();
            }
            else
            {
                MessageBox.Show("Bạn Phải Điền Đầy Đủ Thông Tin", "Thông Báo", MessageBoxButton.OK);
            }
        }
    }
}